package org.eclipse.football;

import static org.junit.Assert.*;

import java.io.IOException;
import java.util.ArrayList;

import org.eclipse.football.Kicker;
import org.eclipse.football.OffPlayer;
import org.eclipse.football.PlayerList;
import org.eclipse.football.DefPlayer;

import org.junit.Test;


public class testPlayerList {

	@Test
	public void testSize() throws IOException {
		ArrayList<OffPlayer> quarter_backs = new ArrayList<OffPlayer>();
		ArrayList<OffPlayer> running_backs = new ArrayList<OffPlayer>();
		ArrayList<OffPlayer> wide_outs = new ArrayList<OffPlayer>();
		ArrayList<OffPlayer> tight_ends = new ArrayList<OffPlayer>();
		ArrayList<Kicker> kickers = new ArrayList<Kicker>();
		ArrayList<DefPlayer> def = new ArrayList<DefPlayer>();
		
		PlayerList.getData("/home/doug/Desktop/qbList.csv", quarter_backs);
		PlayerList.getData("/home/doug/Desktop/rbList.csv", running_backs);
		PlayerList.getData("/home/doug/Desktop/wrList.csv", wide_outs);
		PlayerList.getData("/home/doug/Desktop/teList.csv", tight_ends);
		PlayerList.getDataK("/home/doug/Desktop/kickList.csv", kickers);
		
		assertEquals(kickers.size(), 36);
		assertEquals(quarter_backs.size(), 105);
		assertEquals(running_backs.size(), 206);
		assertEquals(wide_outs.size(), 266);
		assertEquals(tight_ends.size(), 145);
	}
	
	@Test
	public void test2() throws IOException {
		ArrayList<OffPlayer> quarter_backs = new ArrayList<OffPlayer>();
		ArrayList<OffPlayer> running_backs = new ArrayList<OffPlayer>();
		ArrayList<OffPlayer> wide_outs = new ArrayList<OffPlayer>();
		ArrayList<OffPlayer> tight_ends = new ArrayList<OffPlayer>();
		ArrayList<Kicker> kickers = new ArrayList<Kicker>();
		ArrayList<DefPlayer> def = new ArrayList<DefPlayer>();
		
		ArrayList<OffPlayer> quarter_backs2 = new ArrayList<OffPlayer>();
		ArrayList<OffPlayer> running_backs2 = new ArrayList<OffPlayer>();
		ArrayList<OffPlayer> wide_outs2 = new ArrayList<OffPlayer>();
		ArrayList<OffPlayer> tight_ends2 = new ArrayList<OffPlayer>();
		ArrayList<Kicker> kickers2 = new ArrayList<Kicker>();
		
		PlayerList.getData("/home/doug/Desktop/qbList.csv", quarter_backs);
		PlayerList.getData("/home/doug/Desktop/rbList.csv", running_backs);
		PlayerList.getData("/home/doug/Desktop/wrList.csv", wide_outs);
		PlayerList.getData("/home/doug/Desktop/teList.csv", tight_ends);
		PlayerList.getDataK("/home/doug/Desktop/kickList.csv", kickers);
		
		PlayerList playerList = new PlayerList();
		kickers2 = playerList.getKickers();
		assertEquals(kickers.size(), kickers2.size());
		quarter_backs2 = playerList.getOff_players();
		assertEquals(quarter_backs.size(), quarter_backs2.size());
		running_backs2 = playerList.getRunning_backs();
		assertEquals(running_backs.size(), running_backs2.size());
		wide_outs2 = playerList.getWide_outs();
		assertEquals(wide_outs.size(), wide_outs2.size());
		tight_ends2 = playerList.getTight_ends();
		assertEquals(tight_ends.size(), tight_ends2.size());
		
		playerList.setOff_players(quarter_backs2);
		assertEquals(quarter_backs.size(), quarter_backs2.size());
		playerList.setKickers(kickers2);
		assertEquals(kickers.size(), kickers2.size());
		playerList.setRunning_backs(running_backs2);
		assertEquals(running_backs.size(), running_backs2.size());
		
		playerList.setDef_players(def);
		def = playerList.getDef_players();
		
		OffPlayer id = playerList.findOffByName("Not There");
		assertEquals(id, null);
		
		OffPlayer test = new OffPlayer("empty","none");
		test.setName("Test");
		test.setTeam("testTeam");
		
	}
	
}

